 <!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    

    <title>{$Think.config.site.title} - 商品管理</title>

    <meta name="keywords" content="{$Think.config.site.keywords}">

    <link href="{$Think.config.site.resource_url}css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/animate.min.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/style.min.css?v=4.0.0" rel="stylesheet">
    <link href="{$Think.config.site.common_resource_url}js/chosen/chosen.css" rel="stylesheet" type="text/css"/>
</head>
<style>
#listtable .fa{
	cursor:pointer;
	color:#1ab394;
	margin-right:1em;
}
th .tag{font-size: 12px; color: #e66c6c; font-weight: normal;}
.ibox-title .tag{font-size: 12px; color: #e66c6c; font-weight: normal; display: inline-block; margin-left: 20px;}


#listtable .fa.bg-w {
    color: #fff;
}

.input-group select{width: 100%}
</style>
<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">

      <div class="row">
          <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>商品列表</h5>
                    </div>
                    <div class="ibox-content">
                        <div class="row">
                          	<div class="col-sm-12">
                                <div class="input-group pull-right">
                                <form action="{:url('entstockByhand')}" method="get" enctype="application/x-www-form-urlencoded">
                                
                                   
                                <div class="input-group pull-right">
                                    <input type="text" placeholder="请输入关键词" class="input-sm form-control" value="{$Think.get.keywords ?? ''}" name="keywords">
                                    <span class="input-group-btn">
                                        <button type="submit" class="btn btn-sm btn-primary"> 搜索</button> </span>
                                </div>

                                <div class="input-group pull-right" style="margin-right: 10px; width: 200px;">
                                    <select class="input-sm form-control chosen-select" name="cate_id">
                                        <option value="0">商品分类</option>
                                        {volist name="catelist" id="v"}
                                        <option {if($Think.get.cate_id == $v['cate_id'])} selected="selected" {/if} value="{$v.cate_id}">{$v.fullname}</option>
                                        {/volist}
                                    </select>
                                </div>
                                </form>
                                </div>
                            </div>
                            
                        </div>
                        <div class="table-responsive">
                            <table class="table table-striped" id="listtable">
                                <thead>
                                    <tr>
                                        <th width="100">商品图片</th>
                                        <th width="">商品名称</th>
                                        <th width="150">库存</th>
                                        <th width="150">供应商</th>
                                        <th width="150">价格</th>
                                        <th width="200">操作</th>
                                    </tr>
                                </thead>
                                <tbody>

                                	{volist name="list" id="vo"}
                                    <tr data-id="{$vo.goods_id}" data-type="goods" data-specval_id='{$vo.specval_id}' >
                             
                                        <td><img src="{$vo.picture}" width="30" height="30" class="preview" href="{$vo.picture}" title="{$vo.goods_name}"></td>
                                        <td>（{$vo.brand_name}）{$vo.goods_name}【{$vo.specval_name}】</td>
                                        <td>{$vo.stock_num}</td>
                                        <td>{$vo.supplier_name}</td>
                                        <td>{$vo.price}</td>
                                        <td>
                                            <a href="javascript:" class="btn btn-primary entstock"><i class="fa fa-edit bg-w"></i>入库</a>
                                        </td>
                                    </tr>
                                   {/volist}

                                </tbody>
                            </table>
                        </div>
                        <div>{$list->render()}</div>
                    </div>
                </div>
            </div>

        </div>
    </div>

    <script src="{$Think.config.site.resource_url}js/jquery.min.js?v=2.1.4"></script>
    <script src="{$Think.config.site.resource_url}js/bootstrap.min.js?v=3.3.5"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/peity/jquery.peity.min.js"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/iCheck/icheck.min.js"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/layer/layer.js"></script>
    <script src="{$Think.config.site.common_resource_url}js/majax.js"></script>
    <script src="{$Think.config.site.common_resource_url}js/jedit.js"></script>
    <script src="{$Think.config.site.resource_url}js/jquery.imagePreview.1.0.js"></script>
    <script type="text/javascript" src="{$Think.config.site.common_resource_url}js/chosen/chosen.jquery.js"></script>
</body>

</html>
<script>

var layer_font='';
$(document).ready(function() {
	$("select").chosen({no_results_text: "没有找到：",width:'200px'});
	$("img.preview").preview();
	
});	

$('.entstock').click(function(){
	var specval_id=$(this).closest('tr').data('specval_id');
	layer_font = layer.open({
		type: 2,
		title: '手动入库',
		shadeClose: true,
		shade: 0.8,
		area: ['50%', '90%'],
		content: '{:url("actEsbh",'',false)}?specval_id=' + specval_id //iframe的url
	});
})

function editSuccess(){
	window.location.reload(true);
}
</script>